home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / AIncludes / WorldScript.a < prev   
Encoding:
Text File  |  1996-05-01  |  8.8 KB  |  254 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        WorldScript.a
  3. ;
  4. ;    Contains:    WorldScript I Interfaces.
  5. ;
  6. ;    Version:    Technology:    System 7.5
  7. ;                Release:    Universal Interfaces 3.0d3 on Copland DR1
  8. ;
  9. ;    Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10. ;
  11. ;    Bugs?:        If you find a problem with this file, send the file and version
  12. ;                information (from above) and the problem description to:
  13. ;
  14. ;                    Internet:    apple.bugs@applelink.apple.com
  15. ;                    AppleLink:    APPLE.BUGS
  16. ;
  17. ;
  18.     IF &TYPE('__WORLDSCRIPT__') = 'UNDEFINED' THEN
  19. __WORLDSCRIPT__ SET 1
  20.  
  21.     IF &TYPE('__TYPES__') = 'UNDEFINED' THEN
  22.     include 'Types.a'
  23.     ENDIF
  24.     IF &TYPE('__TRAPS__') = 'UNDEFINED' THEN
  25.     include 'Traps.a'
  26.     ENDIF
  27.     IF &TYPE('__QUICKDRAWTEXT__') = 'UNDEFINED' THEN
  28.     include 'QuickdrawText.a'
  29.     ENDIF
  30. ; typedef UInt16                         WSIOffset
  31.  
  32. ; typedef UInt8                         WSIByteCount
  33.  
  34. ; typedef UInt8                         WSIByteIndex
  35.  
  36. ;  offset from start of sub-table to row in state table 
  37. ; typedef UInt16                         WSIStateOffset
  38.  
  39. ; typedef UInt32                         WSITableOffset
  40.  
  41. ; typedef UInt16                         WSISubtableOffset
  42.  
  43. ; typedef UInt16                         WSIGlyphcode
  44.  
  45. ; typedef UInt32                         WSITableIdentifiers
  46.  
  47.  
  48. kScriptSettingsTag                EQU        'info'
  49. kMetamorphosisTag                EQU        'mort'
  50. kGlyphExpansionTag                EQU        'g2g#'
  51. kPropertiesTag                    EQU        'prop'
  52. kJustificationTag                EQU        'kash'
  53. kCharToGlyphTag                    EQU        'cmap'
  54. kGlyphToCharTag                    EQU        'pamc'
  55. kFindScriptRunTag                EQU        'fstb'
  56. ; ***             L O O K U P    T A B L E    T Y P E S        ***
  57.  
  58. WSILookupSimpleArray            EQU        0                    ; a simple array indexed by glyph code 
  59. WSILookupSegmentSingle            EQU        2                    ; segment mapping to single value 
  60. WSILookupSegmentArray            EQU        4                    ; segment mapping to lookup array 
  61. WSILookupSingleTable            EQU        6                    ; sorted list of glyph, value pairs 
  62. WSILookupTrimmedArray            EQU        8                    ; a simple trimmed array indexed by glyph code 
  63. ; typedef unsigned short                 WSILookupTableFormat
  64.  
  65. ; typedef unsigned short                 WSILookupValue
  66.  
  67. ;  An offset from the beginning of the lookup table 
  68. ; typedef unsigned short                 WSILookupOffset
  69.  
  70. ;     FORMAT SPECIFIC DEFINITIONS 
  71. ;
  72. ;        lookupSimpleArray:
  73. ;        
  74. ;        This is a simple array which maps all glyphs in the font
  75. ;        to lookup values.
  76. ;
  77. WSILookupArrayHeader    RECORD 0
  78. lookupValues             ds.w    1                ; offset: $0 (0) <-- really an array of length one ;  The array of values indexed by glyph code 
  79. sizeof                     EQU *                    ; size:   $2 (2)
  80.                         ENDR
  81. ;
  82. ;        lookupTrimmedArray:
  83. ;        
  84. ;        This is a single trimmed array which maps a single range
  85. ;        of glyhs in the font to lookup values.
  86. ;
  87. WSILookupTrimmedArrayHeader RECORD 0
  88. firstGlyph                 ds.w    1                ; offset: $0 (0)
  89. limitGlyph                 ds.w    1                ; offset: $2 (2)
  90. valueArray                 ds.w    1                ; offset: $4 (4) <-- really an array of length one
  91. sizeof                     EQU *                    ; size:   $6 (6)
  92.                         ENDR
  93. ;  The format specific part of the subtable header 
  94. WSILookupFormatSpecificHeader RECORD 0
  95. lookupArray                 ds        WSILookupArrayHeader ; offset: $0 (0)
  96.                          ORG 0
  97. trimmedArray             ds        WSILookupTrimmedArrayHeader ; offset: $0 (0)
  98. sizeof                     EQU *                    ; size:   $6 (6)
  99.                         ENDR
  100. ;  The overall subtable header 
  101. WSILookupTableHeader    RECORD 0
  102. format                     ds.w    1                ; offset: $0 (0)        ;  table format 
  103. fsHeader                 ds        WSILookupFormatSpecificHeader ; offset: $2 (2) ;  format specific header 
  104. sizeof                     EQU *                    ; size:   $8 (8)
  105.                         ENDR
  106. ; ***        G L Y P H    E X P A N S I O N    ***
  107.  
  108.                                                             ; fixed 1.0 
  109. kCurrentGlyphExpansionVersion    EQU        $00010000
  110. ; typedef unsigned short                 GlyphExpansionFormats
  111.  
  112.  
  113. GlyphExpansionLookupFormat        EQU        1
  114. GlyphExpansionContextualFormat    EQU        2
  115. ExpandedGlyphCluster    RECORD 0
  116. numGlyphs                 ds.b    1                ; offset: $0 (0)
  117. bestGlyph                 ds.b    1                ; offset: $1 (1)
  118. glyphs                     ds.w    1                ; offset: $2 (2) <-- really an array of length one
  119. sizeof                     EQU *                    ; size:   $4 (4)
  120.                         ENDR
  121. ExpandedGlyphOffset        RECORD 0
  122. glyph                     ds.w    1                ; offset: $0 (0)
  123. offset                     ds.w    1                ; offset: $2 (2)        ;  offset to ExpandedGlyphCluster 
  124. sizeof                     EQU *                    ; size:   $4 (4)
  125.                         ENDR
  126. GlyphExpansionStateTable RECORD 0
  127. stateTableOffset         ds.w    1                ; offset: $0 (0)
  128. classTableOffset         ds.w    1                ; offset: $2 (2)
  129. actionTableOffset         ds.w    1                ; offset: $4 (4)        ;  state, class and actions tables follow here... 
  130. sizeof                     EQU *                    ; size:   $6 (6)
  131.                         ENDR
  132. GlyphExpansionTable        RECORD 0
  133. version                     ds.l    1                ; offset: $0 (0)
  134. format                     ds.w    1                ; offset: $4 (4)
  135. expansionNumer             ds.w    1                ; offset: $6 (6)
  136. expansionDenom             ds.w    1                ; offset: $8 (8)        ;  num/denom ratio for expansion <2> 
  137. stateTable                 ds        GlyphExpansionStateTable ; offset: $A (10)
  138.                          ORG 10
  139. lookup                     ds        WSILookupTableHeader ; offset: $A (10) ;  expanded glyph clusters follow here... 
  140. sizeof                     EQU *                    ; size:   $12 (18)
  141.                         ENDR
  142. ;  Glyph-to-Character constants and types  
  143.  
  144. kCurrentGlyphToCharVersion        EQU        $00010100
  145. ; typedef unsigned short                 GlyphToCharLookupFormats
  146.  
  147.  
  148. kGlyphToCharLookup8Format        EQU        1
  149. kGlyphToCharLookup16Format        EQU        2
  150. kGlyphToCharLookup32Format        EQU        3
  151. ; typedef UInt8                         GlyphToCharFontIndex
  152.  
  153. ; typedef UInt8                         QDGlyphcode
  154.  
  155. GlyphToCharActionTable    RECORD 0
  156. fontNameOffset             ds.w    1                ; offset: $0 (0)        ;  offset relative to this table 
  157. actions                     ds        WSILookupTableHeader ; offset: $2 (2)    ;  only support lookupSimpleArray format for now 
  158. sizeof                     EQU *                    ; size:   $A (10)
  159.                         ENDR
  160. GlyphToCharActionHeader    RECORD 0
  161. numTables                 ds.w    1                ; offset: $0 (0)        ;  0..n 
  162. offsets                     ds.w    1                ; offset: $2 (2) <-- really an array of length one ;  offsets from start of action table header 
  163. sizeof                     EQU *                    ; size:   $4 (4)
  164.                         ENDR
  165. GlyphToCharHeader        RECORD 0
  166. version                     ds.l    1                ; offset: $0 (0)
  167. actionOffset             ds.w    1                ; offset: $4 (4)        ;  offset to GlyphToCharActionHeader 
  168. format                     ds.w    1                ; offset: $6 (6)        ;  size of font mask 
  169. mappingTable             ds        WSILookupTableHeader ; offset: $8 (8)
  170. sizeof                     EQU *                    ; size:   $10 (16)
  171.                         ENDR
  172. ;
  173. ; JUSTIFICATION TYPES
  174. ;    WorldScript supports justification of text using insertion. The justification
  175. ;    table specifies a insertion string to insert between 2 specified glyphs.
  176. ;    Each combination of inter-glyph boundary can be assigned a justification priority,
  177. ;    the higher the priority the more justification strings inserted at that position.
  178. ;    
  179. ;    The priorities for each inter-glyph boundary are specified by the justification table's
  180. ;    state table.
  181. ;    
  182. ;    Special handling is done for scripts which use spaces to justify, because the width of 
  183. ;    a space varies depending on the setting of SpaceExtra. This is why the number of spaces
  184. ;    per inserting string is specified in the justification table.
  185. ;
  186. ;
  187.  
  188.                                                             ; 1.0 not supported 
  189. kCurrentJustificationVersion    EQU        $0200
  190.  
  191. kJustificationStateTableFormat    EQU        1
  192.  
  193.                                                             ; WSI's internal limitation <12> 
  194. kMaxJustificationStringLength    EQU        13
  195. ; typedef UInt8                         WSIJustificationPriority
  196.  
  197.  
  198. WSIJustificationSetMarkMask        EQU        $80
  199. WSIJustificationStateEntry RECORD 0
  200. markPriority             ds.b    1                ; offset: $0 (0)        ;  non-zero priorities means insertion 
  201. priority                 ds.b    1                ; offset: $1 (1)
  202. newState                 ds.w    1                ; offset: $2 (2)
  203. sizeof                     EQU *                    ; size:   $4 (4)
  204.                         ENDR
  205. ; typedef unsigned short                 WSIJustificationClasses
  206.  
  207.  
  208. wsiJustEndOfLineClass            EQU        0
  209. wsiJustEndOfRunClass            EQU        1
  210. wsiJustDeletedGlyphClass        EQU        2
  211. wsiJustUserDefinedClass            EQU        3
  212. ; typedef unsigned short                 WSIJustificationStates
  213.  
  214.  
  215. wsiStartOfLineState                EQU        0                    ; pre-defined states 
  216. wsiStartOfRunState                EQU        1
  217. wsiUserDefinedState                EQU        2
  218. ;  pre-multiplied: class# * sizeof(WSIJustificationStateEntry) 
  219. ; typedef UInt8                         WSIJustificationClassOffset
  220.  
  221. WSIJustificationStateTable RECORD 0
  222. maxPriorities             ds.w    1                ; offset: $0 (0)
  223. rowWidth                 ds.w    1                ; offset: $2 (2)        ;  width of a state table row in bytes 
  224. classTableOffset         ds.w    1                ; offset: $4 (4)
  225. stateTableOffset         ds.w    1                ; offset: $6 (6)
  226. sizeof                     EQU *                    ; size:   $8 (8)
  227.                         ENDR
  228. ;
  229. ;            Last two fields of above structure - someday?
  230. ;            WSIJustificationClassOffset    classes[up to 64 classes supported];
  231. ;            WSIJustificationStateEntry    states[up to your heart's desire];
  232. ;
  233. WSIJustificationHeader    RECORD 0
  234. version                     ds.w    1                ; offset: $0 (0)
  235. format                     ds.w    1                ; offset: $2 (2)
  236. scaling                     ds        Point            ; offset: $4 (4)        ;  numer/denom scaling of priority weights <7> 
  237. spacesPerInsertion         ds.w    1                ; offset: $8 (8)        ;  # of $20 chars in justification insertion string <12> 
  238. justStringOffset         ds.w    1                ; offset: $A (10)        ;  offset to justification string 
  239. stateTable                 ds        WSIJustificationStateTable ; offset: $C (12) ;  long-aligned boundary aligned w/ spacesPerInsertion field - justification string follows 
  240. sizeof                     EQU *                    ; size:   $14 (20)
  241.                         ENDR
  242. ;  Line Layout's Property table version <11> 
  243.  
  244.                                                             ; v1.0 
  245. currentPropsTableVersion        EQU        $00010000
  246.  
  247.                                                             ; ??? is this right 
  248. kCharToGlyphCurrentVersion        EQU        100
  249. ;  pass as priorityWeight to JustifyWSILayout to use script's current just setting 
  250.  
  251. kScriptsDefaultJustWeight        EQU        -1
  252.     ENDIF ; __WORLDSCRIPT__ 
  253.  
  254.